﻿<UserControl x:Class="MetroDemo.ExampleViews.SliderProgressExamples"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:MetroDemo="clr-namespace:MetroDemo"
             xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
             mc:Ignorable="d"
             d:DesignHeight="600"
             d:DesignWidth="800"
             d:DataContext="{d:DesignInstance MetroDemo:MainWindowViewModel}">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro.Resources;component/Icons.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatSlider.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Grid.Column="0">
            <Label Content="Horizontal Slider"
                   Style="{DynamicResource DescriptionHeaderStyle}" />
            <Slider x:Name="horizSlider"
                    Minimum="0"
                    Maximum="100"
                    Value="20"
                    LargeChange="10"
                    SmallChange="1"
                    Width="200"
                    Margin="0, 10, 0, 0" />
            <Slider Width="200"
                    Style="{DynamicResource FlatSlider}"
                    Margin="0, 10, 0, 0"
                    Value="50" />
            <Slider Width="200"
                    Margin="0, 10, 0, 0"
                    IsEnabled="False" />
            <Slider Width="200"
                    Style="{DynamicResource FlatSlider}"
                    Margin="0, 10, 0, 0"
                    IsEnabled="False"
                    Value="50" />
        </StackPanel>
        <StackPanel Grid.Row="0"
                    Grid.Column="1">
            <Label Content="Vertical Slider"
                   Style="{DynamicResource DescriptionHeaderStyle}" />
            <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Center">
                <Slider Orientation="Vertical"
                        Height="200"
                        Cursor="SizeNS" />
                <Slider Orientation="Vertical"
                        Margin="10, 0, 0, 0"
                        Height="200"
                        Style="{DynamicResource FlatSlider}"
                        Value="50" />
                <Slider Orientation="Vertical"
                        Height="200"
                        Margin="10, 0, 0, 0"
                        IsEnabled="False" />
                <Slider Orientation="Vertical"
                        Margin="10, 0, 0, 0"
                        Height="200"
                        Style="{DynamicResource FlatSlider}"
                        Value="50"
                        IsEnabled="False" />
            </StackPanel>
        </StackPanel>
        <StackPanel Grid.Row="0"
                    Grid.Column="2">
            <Label Content="RangeSlider"
                   Style="{DynamicResource DescriptionHeaderStyle}" />
            <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Left">
                <Controls:RangeSlider Orientation="Vertical"
                                      MinRangeWidth="20"
                                      Height="200"
                                      x:Name="RangeSlider"
                                      AutoToolTipPlacement="BottomRight"
                                      AutoToolTipPrecision="2"
                                      LowerValueChanged="RangeSlider_OnLowerValueChanged"
                                      UpperValueChanged="RangeSlider_OnUpperValueChanged"
                                      CentralThumbDragStarted="RangeSlider_OnCentralThumbDragStarted"
                                      CentralThumbDragCompleted="RangeSlider_OnCentralThumbDragCompleted"
                                      TickPlacement="Both"
                                      TickFrequency="20"
                                      IsSnapToTickEnabled="True"
                                      MinRange="0"
                                      Minimum="-200"
                                      Maximum="200"
                                      IsMoveToPointEnabled="True"
                                      ExtendedMode="True"
                                      MoveWholeRange="False"
                                      SmallChange="0.1"
                                      LowerValue="-70"
                                      UpperValue="60" />
                <StackPanel Orientation="Vertical" Margin="5, 0, 0, 0" Width="228">

                    <Controls:RangeSlider Orientation="Horizontal"
                                          MinRangeWidth="20"
                                          x:Name="RangeSlider1"
                                          AutoToolTipPlacement="BottomRight"
                                          AutoToolTipPrecision="2"
                                          LowerValueChanged="RangeSlider_OnLowerValueChanged"
                                          UpperValueChanged="RangeSlider_OnUpperValueChanged"
                                          CentralThumbDragStarted="RangeSlider_OnCentralThumbDragStarted"
                                          CentralThumbDragCompleted="RangeSlider_OnCentralThumbDragCompleted"
                                          LowerThumbDragDelta="RangeSlider_OnLowerThumbDragDelta"
                                          UpperThumbDragDelta="RangeSlider_OnUpperThumbDragDelta"
                                          CentralThumbDragDelta="RangeSlider_OnCentralThumbDragDelta"
                                          LowerThumbDragStarted="RangeSlider_OnLowerThumbDragStarted"
                                          LowerThumbDragCompleted="RangeSlider_OnLowerThumbDragCompleted"
                                          UpperThumbDragStarted="RangeSlider_OnUpperThumbDragStarted"
                                          UpperThumbDragCompleted="RangeSlider_OnUpperThumbDragCompleted"
                                          TickPlacement="TopLeft"
                                          TickFrequency="20"
                                          IsSnapToTickEnabled="False"
                                          MinRange="0"
                                          Minimum="-200"
                                          Maximum="205"
                                          IsMoveToPointEnabled="True"
                                          ExtendedMode="True"
                                          MoveWholeRange="False"
                                          SmallChange="0.1"
                                          LowerValue="120"
                                          UpperValue="100"
                                          Height="28"
                                          Margin="0,0,0,20" />

                    <Controls:RangeSlider Name="RangeSlider2"
                                          TickPlacement="Both"
                                          AutoToolTipPlacement="TopLeft"
                                          LowerValue="20"
                                          UpperValue="360"
                                          Maximum="610"
                                          Margin="0,0,0,20" />

                    <Controls:RangeSlider
                                          TickPlacement="Both"
                                          IsEnabled="False"
                                          Margin="0,0,0,20" />
                    <Controls:RangeSlider
                                          Height="20"
                                          IsEnabled="False"
                                          LowerValue="20"
                                          UpperValue="60"
                                          Margin="0,0,0,20" />
                </StackPanel>
            </StackPanel>


        </StackPanel>
        <StackPanel Grid.Row="1"
                    Grid.Column="0">
            <Label Content="ProgressBar"
                   Style="{DynamicResource DescriptionHeaderStyle}" />
            <ProgressBar Value="{Binding ElementName=horizSlider, Path=Value}"
                         Minimum="0"
                         Maximum="100"
                         Width="200"
                         Margin="0, 10, 0, 0" />
            <ProgressBar Width="200"
                         Margin="0, 10, 0, 0"
                         Value="50" />
            <ProgressBar Width="200"
                         Margin="0, 10, 0, 0"
                         IsIndeterminate="True"
                         Value="100" />

            <Label Content="MetroProgressBar"
                   Style="{DynamicResource DescriptionHeaderStyle}" />
            <Controls:MetroProgressBar Value="{Binding ElementName=horizSlider, Path=Value}"
                                       Minimum="0"
                                       Maximum="100"
                                       Width="200"
                                       Foreground="{DynamicResource AccentColorBrush}"
                                       Margin="0, 10, 0, 0" />
            <Controls:MetroProgressBar IsIndeterminate="True"
                                       Value="{Binding ElementName=horizSlider, Path=Value}"
                                       Minimum="0"
                                       Maximum="100"
                                       Width="200"
                                       Foreground="{DynamicResource AccentColorBrush}"
                                       Margin="0, 10, 0, 0" />
        </StackPanel>
        <StackPanel Grid.Row="1"
                    Grid.Column="1">
            <Label Content="ProgressRing"
                   Style="{DynamicResource DescriptionHeaderStyle}" />
            <Grid Margin="20, 0, 20, 0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Controls:ProgressRing Grid.Column="0"
                                       IsActive="True"
                                       Visibility="{Binding MagicToggleButtonIsChecked, Converter={StaticResource BoolToVisibilityConverter}, UpdateSourceTrigger=PropertyChanged}" />
                <Controls:ProgressRing Grid.Column="1"
                                       IsActive="True"
                                       Width="40"
                                       Height="40" />
                <Controls:ProgressRing Grid.Column="2"
                                       IsActive="True"
                                       Width="20"
                                       Height="20" />
            </Grid>
        </StackPanel>
        <Grid Grid.Row="2"
              Grid.Column="2">
            <Label VerticalAlignment="top"
                   Content="Sliders TickPlacement"
                   Style="{DynamicResource DescriptionHeaderStyle}" />
            <Slider Style="{DynamicResource FlatSlider}"
                    VerticalAlignment="top"
                    IsSnapToTickEnabled="True"
                    HorizontalAlignment="Left"
                    Width="132"
                    Margin="122,39,0,0"
                    TickPlacement="Both"
                    TickFrequency="25" />
            <Slider VerticalAlignment="top"
                    HorizontalAlignment="Left"
                    Width="132"
                    Margin="122,112,0,0"
                    TickPlacement="BottomRight"
                    TickFrequency="25"
                    Value="50" />
            <Slider VerticalAlignment="top"
                    HorizontalAlignment="Left"
                    Width="132"
                    Margin="122,207,0,0"
                    TickPlacement="TopLeft"
                    TickFrequency="25"
                    Value="50" />
            <Slider Style="{DynamicResource FlatSlider}"
                    VerticalAlignment="top"
                    HorizontalAlignment="Left"
                    Height="113"
                    Margin="10,44,0,0"
                    TickPlacement="Both"
                    TickFrequency="25"
                    Value="50"
                    Orientation="Vertical" />
            <Slider VerticalAlignment="top"
                    HorizontalAlignment="Left"
                    Height="113"
                    Margin="27,44,0,0"
                    TickPlacement="BottomRight"
                    TickFrequency="25"
                    Value="50"
                    Orientation="Vertical" />
            <Slider VerticalAlignment="top"
                    HorizontalAlignment="Left"
                    Height="113"
                    Margin="70,44,0,0"
                    TickPlacement="TopLeft"
                    TickFrequency="25"
                    Value="50"
                    Orientation="Vertical" />
        </Grid>
    </Grid>

</UserControl>
